import http from 'k6/http';
import {check} from 'k6';

export let options={
	discardResponseBodies:false,
	scenarios:{
		my_test:{
			executor:'shared-iterations',
			vus:10,
			iterations:10,
			maxDuration:'10s',
		}
	},
};

var count = 400;

export default function(){
	var url = 'http://demoUrl';
	count+=Math.random()*100;
	
	var patientData = JSON.stringify({
		name:'测试'+count,
		administrativeGenderCode:'1',
		ids:[{
			'code':'1.11',
			'identifier':''+count
		}],
	});
	var params = {
		headers:{
			'Content-Type':'application/json',
			'Authorization':'8c014ad296bb166326cee34cba93de1f4be83dc6f0a9ede28de37d2430737fb0',
		},
		
	};
	let res = http.post(url, patientData, params);
	check(res, {'status was 200':(r)=>r.status==200});
	console.log("Response body:"+res.body);
	console.log("Response headers"+res.headers);
	
}